﻿<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<Deepcode.ValidationSample.Models.BookViewModel>" %>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

	<h2>SIMPLE FORM</h2>

	<p>This example will validation client and server side. A custom validation executes on the server side, so try making the client validation pass, but 
	in the author field, specify Tony Johnson as the author - this will fail server side validation. In addition this demonstrates the use of a custom client
	and server side validator - enter Bill Gates as the author to see this trigger client side or enter Richard Branson to see it trigger server side.</p>
	
	
	<%Html.EnableClientValidation();%>
	<%using( Html.BeginForm("PostFormData", "SimpleForm", FormMethod.Post )){%>

	<%:Html.AntiForgeryToken()%>

	<fieldset>
		<legend>Book details</legend>

		<%:Html.LabelFor( m => m.Title )%>
		<%:Html.EditorFor( m => m.Title )%>
		<%:Html.ValidationMessageFor( m => m.Title )%>

		<%:Html.LabelFor( m => m.Author )%>
		<%:Html.EditorFor( m => m.Author )%>
		<%:Html.ValidationMessageFor( m => m.Author )%>

		<%:Html.LabelFor( m => m.IsbnNumber )%>
		<%:Html.EditorFor( m => m.IsbnNumber )%>
		<%:Html.ValidationMessageFor( m => m.IsbnNumber )%>

	</fieldset>

	<fieldset>
		<legend>Book description</legend>
		<%:Html.LabelFor( m => m.Synopsis )%>
		<%:Html.TextAreaFor( m => m.Synopsis, new{ @class="large-text-area" })%>
	</fieldset>


	<fieldset>
		<legend>Pricing</legend>
		
		<%:Html.LabelFor( m => m.Price )%>
		<%:Html.EditorFor( m => m.Price )%>
		<%:Html.ValidationMessageFor( m => m.Price )%>
	
	</fieldset>
	
	<input type="submit" value="Save book"/>

	<%}%>

</asp:Content>
